<!--
 * @Author: wangming
 * @Date: 2021-04-02 13:38:40
 * @LastEditors: wangming
 * @LastEditTime: 2021-12-13 17:34:07
 * @Description: file content
-->
<template>
  <el-form-item label="公式" prop="__config.formulaText">
    <el-input
      v-model="value.__config.formulaText"
      placeholder="计算公式="
      readonly
      @click.native="openFormulaModule"
    ></el-input>
  </el-form-item>
</template>

<script>
import basicmixins from "../basicmixins";
import { openFormula } from "./formula/index";
import { mapActions, mapGetters } from "vuex";
export default {
  mixins: [basicmixins],
  computed: {
    ...mapGetters(["getFormList"]),
    originModelList() {
      let arr = this.getFormList?.filter(
        (i) =>
          this.value?.__config.originModelNameList.indexOf(i.tagName) > -1 &&
          !!i.modelName
      );
      return arr || [];
    },
  },
  methods: {
    openFormulaModule() {
      openFormula(this.originModelList, this.value.__config.formula).then(
        (list, text) => {
          this.value.__config.formula = list;
          this.$set(this.value.__config,"formulaText","计算公式= " + text)
        }
      );
    },
  },
};
</script>

<style lang="scss" scoped></style>
